package com.zhizhi.util;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * 信息收集工具类
 */
public class CollectUtil {
    public static   String getReturnData(String nmapDir,String command){
        Process process =  null ;
        StringBuffer stringBuffer =  new  StringBuffer();
        try  {
            process = Runtime.getRuntime().exec(nmapDir +  " "  + command);
            System.out.println( "请稍等。。。" );
            BufferedReader reader =  new  BufferedReader( new InputStreamReader(process.getInputStream(), "UTF-8" ));
            String line =  null ;
            while ((line = reader.readLine()) !=  null ){
                stringBuffer.append(line +  "\n" );
            }
        }  catch  (IOException e) {
            e.printStackTrace();
        }
        return  stringBuffer.toString();
    }
}
